package com.jhc.drone.communication.ws;


import cn.hutool.json.JSONObject;
import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;

/**
 * @author lcp
 * @date 2025年01月2025/1/6 11:33
 * @describe
 */
@Data
@Accessors(chain = true)
public class WsDto implements Serializable {

    private String flag;

    private String value;

    private String description;

    private String sn;

    public WsDto setObject(String key, Object value, String key2, Object value2) {
        JSONObject entries = new JSONObject();
        entries.set(key, value);
        entries.set(key2, value2);
        this.value = entries.toString();
        return this;
    }

    public WsDto setObject(String key, Object value, String key2, Object value2, String key3, Object value3) {
        JSONObject entries = new JSONObject();
        entries.set(key, value);
        entries.set(key2, value2);
        entries.set(key3, value3);
        this.value = entries.toString();
        return this;
    }

    public WsDto setObject(String key, Object value, String key2, Object value2, String key3, Object value3, String key4, Object value4) {
        JSONObject entries = new JSONObject();
        entries.set(key, value);
        entries.set(key2, value2);
        entries.set(key3, value3);
        entries.set(key4, value4);
        this.value = entries.toString();
        return this;
    }
}
